package com.mall.task.hook;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 关闭钩子
 * @author zhoufeng
 *
 */
public class ShutdownHook extends Thread{
	
	private ClassPathXmlApplicationContext applicationContext ;
	
	public ShutdownHook(ClassPathXmlApplicationContext applicationContext) {
		this.applicationContext = applicationContext ;
	}

	@Override
	public void run() {
		System.out.println("服务正在关闭..."); 
		
		//这里可以写服务关闭时的一下操作
		
		applicationContext.close();
		
		System.out.println("服务关闭成功..."); 
	}

}
